package zzhyc.keystore

import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.KsInitCallback
import com.kwad.sdk.api.SdkConfig

private const val TAG = "ShouKuaiActivity"

class ShouKuaiActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_shou_kuai)

        initKSSdk()
    }

    private fun initKSSdk() {
        KsAdSDK.init(
            this, SdkConfig.Builder()
                .appId(ShouKuaiKey.KS_APP_ID).appName(ShouKuaiKey.KS_APP_NAME)
                .showNotification(false)
                .debug(true)
                .setStartCallback(object : KsInitCallback {
                    override fun onSuccess() {
                        Log.i(TAG, "快手sdk初始化onSuccess: ")
                        startActivity(
                            Intent(
                                this@ShouKuaiActivity, ShouKuaiSplashActivity::class.java
                            )
                        )
                        finish()
                    }

                    override fun onFail(p0: Int, p1: String?) {
                        Log.i(TAG, "快手sdk初始化onSuccess: ${p0}，msg-- ${p1}")
                    }
                })
                .build()
        )
        KsAdSDK.start()
    }
}